// MainWindow.cpp : implementation file
//

#include "stdafx.h"
#include "PerSim.h"
#include "MainWindow.h"
#include "PerSimDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainWindow

IMPLEMENT_DYNCREATE(CMainWindow, CView)

CMainWindow::CMainWindow()
{
}

CMainWindow::~CMainWindow()
{
}


BEGIN_MESSAGE_MAP(CMainWindow, CView)
	//{{AFX_MSG_MAP(CMainWindow)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainWindow drawing

void CMainWindow::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CMainWindow diagnostics

#ifdef _DEBUG
void CMainWindow::AssertValid() const
{
	CView::AssertValid();
}

void CMainWindow::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainWindow message handlers

int CMainWindow::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
//	CRect rect ;
//	GetClientRect(&rect) ;
//	CClientDC* pDc = new CClientDC(this) ;
//	m_pSence.InitialOpenGL(pDc,rect.Width(),rect.Height()) ;
//	m_pSence.SetViewName(_T("Origal Model")) ;
	return 0;
}

void CMainWindow::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
//	RedrawWindow() ;
	m_pSence.SetViewWindowRange(cx,cy) ;
}

void CMainWindow::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
//	wglMakeCurrent(dc.GetSafeHdc(),m_pSence.m_hRC) ;
//	m_pSence.RenderSence(my_zNear) ;
	// Do not call CView::OnPaint() for painting messages
}
